package com.cc.bsp.domain;

import java.util.List;

import com.cc.bsp.domain.exception.DomainException;
import com.cc.bsp.persistence.dao.IQueryPageOrder;

public abstract class AbstractDomain implements Domain {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3209555264327715390L;

	protected DomainRepositoryService repositoryService;

	protected java.io.Serializable id;

	public void create() throws DomainException {
		getRepositoryService().create(this);
	}

	public void update() throws DomainException {
		getRepositoryService().update(this);
	}

	public void delete() throws DomainException {
		getRepositoryService().delete(this);
	}

	public Domain findById() throws DomainException {
		return getRepositoryService().findById(id);
	}

	public Domain findOne() throws DomainException {
		return getRepositoryService().findOne(this);
	}

	public List<Domain> findList() throws DomainException {
		return getRepositoryService().findList(this);
	}

	public List<Domain> findAll() throws DomainException {
		return getRepositoryService().findAll();
	}

	public List<Domain> findList(IQueryPageOrder pageOrder)
			throws DomainException {
		return getRepositoryService().findList(this, pageOrder);
	}

	public List<Domain> findAll(IQueryPageOrder pageOrder)
			throws DomainException {
		return getRepositoryService().findAll(pageOrder);
	}

	public abstract DomainRepositoryService getRepositoryService() throws DomainException;

	public java.io.Serializable getId() {
		return id;
	}

	public void setId(java.io.Serializable id) {
		this.id = id;
	}

}
